package com.project.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.framework.config.BigDecimalSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 横向出账合同 biz_buyer_contract
 *
 * @author baige
 * @date 2025-02-25
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("横向出账合同")
public class BizBuyerContract extends TimeUserEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @ApiModelProperty("流程id")
    private String processInstanceId;

    //-------------------原项目信息---------------------------

    @ApiModelProperty("原项目名称")
    @Excel(name = "原项目名称")
    private String sourceProjectName;


    @ApiModelProperty("原项目分类 -存code")
    private String sourceProjectType;


    @ApiModelProperty("原项目负责人")
    @Excel(name = "原项目负责人")
    private String sourceChargerName;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("原项目签订日期")
    @Excel(name = "原项目签订日期",dateFormat="yyyy-MM-dd")
    private Date sourceAuthorizeDate;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("原项目结束日期")
    @Excel(name = "原项目结束日期",dateFormat="yyyy-MM-dd")
    private Date sourceEndDate;


    @ApiModelProperty("原项目合同金额(万元)")
    @Excel(name = "原项目合同金额(万元)")
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal sourceFeeAuthorize;

    @ApiModelProperty("原项目性质")
    @Excel(name = "原项目性质")
    private String sourceProjectClass;


    //---------------基本信息-------------------------------

    @ApiModelProperty("合同编号")
    @Excel(name = "合同编号")
    private String code;


    @ApiModelProperty("合同名称")
    @Excel(name = "合同名称")
    private String name;


    @ApiModelProperty("负责人编号")
    @Excel(name = "负责人编号")
    private String chargerCode;


    @ApiModelProperty("合同负责人")
    @Excel(name = "合同负责人")
    private String chargerName;


    @ApiModelProperty("负责人电话")
    @Excel(name = "负责人电话")
    private String chargerTel;


    @ApiModelProperty("合同金额(万元)")
    @Excel(name = "合同金额(万元)")
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal feeAuthorize;


    @ApiModelProperty("所属单位")
    private String unitId;


    @ApiModelProperty("交付形式")
    private String deliveryForm;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("签订日期")
    @Excel(name = "签订日期",dateFormat="yyyy-MM-dd")
    private Date authorizeDate;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("开始日期")
    @Excel(name = "开始日期",dateFormat="yyyy-MM-dd")
    private Date beginDate;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty("结束日期")
    @Excel(name = "结束日期",dateFormat="yyyy-MM-dd")
    private Date planEndDate;


    @ApiModelProperty("合同状态")
    @Excel(name = "合同状态")
    @Schema(description = "进行:0 完成:1 中止:2")
//    SELECT id,code,categoryId,name FROM cfg_category_entry WHERE (categoryid = '2c90810a4de1fc0a014de2033bef0007')
    private String projectStatusId;

    @ApiModelProperty("甲方是否盖章")
    @Excel(name = "甲方是否盖章")
    private String buyerIsSeal;


    @ApiModelProperty("供方是否盖章")
    @Excel(name = "供方是否盖章")
    private String yfIsSeal;


    @ApiModelProperty("合同是否回收")
    @Excel(name = "合同是否回收")
    private String isRecover;

    @ApiModelProperty("盖章页电子版")
    private String signature;


    //----------------供方信息---------------------------

    @ApiModelProperty("供方单位")
    @Excel(name = "供方单位")
    private String yfUnitName;


    @ApiModelProperty("供方单位性质")
    private String yfUnitKind;


    @ApiModelProperty("供方社会信用代码")
    @Excel(name = "供方社会信用代码")
    private String yfCode;


    @ApiModelProperty("供方联系人名称")
    @Excel(name = "供方联系人名称")
    private String yfChargerName;


    @ApiModelProperty("供方电话")
    @Excel(name = "供方电话")
    private String yfTel;


    @ApiModelProperty("供方所属省份")
    private String yfArea;


    @ApiModelProperty("供方所属地市")
    private String yfCity;


    @ApiModelProperty("合同类型")
    private String contractType;


    @ApiModelProperty("教育部统计归属")
    private String sourceSubjectClassId;


    @ApiModelProperty("原项目一级学科")
    private String sourceSubjectId;


    @ApiModelProperty("供方收款人")
    @Excel(name = "供方收款人")
    private String yfPayee;


    @ApiModelProperty("供方开户银行")
    @Excel(name = "供方开户银行")
    private String yfBankName;


    @ApiModelProperty("供方开户账号")
    @Excel(name = "供方开户账号")
    private String yfBankAccount;


    @ApiModelProperty("供方国别")
    @Excel(name = "供方国别")
    private String yfNationality;


    @ApiModelProperty("供方是否海外单位")
    @Excel(name = "供方是否海外单位")
    private String yfIsOverseas;


    @ApiModelProperty("备注")
    @Excel(name = "备注")
    private String note;

    //----------------其他-------------------------------

    @ApiModelProperty("附件")
    private String fileIds;


    @ApiModelProperty("审核人")
    private String checker;


    @ApiModelProperty("审核状态 -1:暂存,1:审批中,2:审批通过,3:审批不通过")
    private String checkstatus;


    @ApiModelProperty("申报审核时间")
    private String checkdate;


    @ApiModelProperty("所有成员Id")
    private String authorpids;


    @ApiModelProperty("所有成员部门Id")
    private String authorunitids;


    @ApiModelProperty("数据完善状态")
    private String completedatastatus;


    @ApiModelProperty("项目来源")
    private String sourceProjectId;

    //盖章电子版集合
    @TableField(exist = false)
    private List<Map<String,String>> signatureList;

    //电子合同版集合
    @TableField(exist = false)
    private List<Map<String,String>> fileList;

    //--------------------联表查询的值-------------------------

    @ApiModelProperty("原项目分类的值")
    @TableField(exist = false)
    @Excel(name = "原项目分类")
    private String sourceProjectTypeValue;

    @ApiModelProperty("所属单位的值")
    @TableField(exist = false)
    @Excel(name = "所属单位")
    private String unitValue;


    @ApiModelProperty("交付形式-交付形式")
    @TableField(exist = false)
    @Excel(name = "交付形式")
    private String deliveryFormValue;

    @ApiModelProperty("供方单位性质-甲方类别")
    @TableField(exist = false)
    @Excel(name = "供方单位性质")
    private String yfUnitKindValue;

    @ApiModelProperty("供方所属省份-甲方地区")
    //select LOCATION_ID as codeColumn, LOCATION_NAME as valueColumn , "upcodeColumn" as upcodeColumn, LOCATION_NAME_LOCAL as valueColumnLocal from DM_LOCATION WHERE LOCATION_ID LIKE '__0000'
    @TableField(exist = false)
    @Excel(name = "供方所属省份")
    private String yfAreaValue;

    @ApiModelProperty("供方所属地市-甲方所属地市")
    // select LOCATION_ID as codeColumn, LOCATION_NAME as valueColumn , UP_LOCATION_ID as upcodeColumn,
    // LOCATION_NAME_LOCAL as valueColumnLocal from DM_LOCATION WHERE (location_id like '____00' or location_id like '11____' or
    // location_id like '12____' or location_id like '31____' or location_id like '50____')
    @TableField(exist = false)
    @Excel(name = "供方所属地市")
    private String yfCityValue;

    @TableField(exist = false)
    @Excel(name = "审核状态")
    private String checkstatusValue;


    @TableField(exist = false)
    private Boolean isAuditor;

    @ApiModelProperty("提交类型 -> -1:暂存,1:提交,2:保存并通过")
    @TableField(exist = false)
    private Integer submitType;


    @ApiModelProperty("流程节点id")
    @TableField(exist = false)
    private String taskId;

}
